package com.xiaoxiang.game.service.impl;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaoxiang.game.dao.GameDao;
import com.xiaoxiang.game.entity.Game;
import com.xiaoxiang.game.service.GameService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * (Game)表服务实现类
 *
 * @author haha
 * @since 2022-03-19 22:38:12
 */
@Service("gameService")
public class GameServiceImpl extends ServiceImpl<GameDao, Game> implements GameService {

    @Override
    public List<Game> getHotList(Integer size) {
        Page<Game> page = new Page<>();
        page.addOrder(OrderItem.desc("download_num"));
        page.setMaxLimit(size.longValue());
        return this.page(page).getRecords();
    }
}
